#ifndef PREFERENCESDIALOG_H
#define PREFERENCESDIALOG_H

#include <QDialog>
#include <QListWidget>
#include <QStackedWidget>
#include <QLabel>
#include <QSettings>
#include <QWidget>
#include <QDialogButtonBox>
#include <QTreeWidget>
#include <QComboBox>
#include <QCheckBox>

struct SHORTCUT {
    int         key;
    quint32     modifiers;
    QString     shortcut_text;
    QString     keywords;
};


class PreferencesDialog : public QDialog
{
    Q_OBJECT
public:
    PreferencesDialog(QWidget *parent = 0);
private:
    void createIcons();

    QListWidget *content;
    QStackedWidget *pages;
};

class GeoPage : public QWidget
{
    Q_OBJECT
public:
     GeoPage(QWidget *parent = 0);
private slots:
     void selectWaypointFile();
private:
     QLabel *waypointLabel;
     QSettings settings;
};

class ShortcutsPage : public QWidget
{
    Q_OBJECT
public:
     ShortcutsPage(QWidget *parent = 0);
private slots:
     void addNewShortcut();
     void removeShortcut();
     void toggleRemoveButton();
private:
     void readShortcuts();
     //QString modifierToString(const quint32 modifiers);

     QList<SHORTCUT> shortcuts;
     QSettings settings;
     QPushButton *removeButton;
     QTreeWidget *shortcutTree;
};

class TagPage : public QWidget
{
    Q_OBJECT
public:
     TagPage(QWidget *parent = 0);
private slots:
     void saveSettings();
private:
     QCheckBox *use_iptc_cb;
     QCheckBox *use_xmp_cb;
     QComboBox *enc_combo;
     QCheckBox *enc_name_save;
     QSettings settings;
};


class AddShortcutDialog : public QDialog
{
    Q_OBJECT
public:
    AddShortcutDialog(QWidget *parent = 0);
protected:
    //! Event handler override for key press events
    void keyPressEvent(QKeyEvent *event);
private slots:
    void keywordEdited();
    void accept();
private:
    QString modifierToString(const quint32 modifiers);

    SHORTCUT shortcut;
    QSettings settings;
    QLineEdit *shortcutKey;
    QLineEdit *keywords;
    QDialogButtonBox *buttonBox;
};

#endif // PREFERENCESDIALOG_H
